﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Input;
using Modules.Core;

namespace ComputerStoreManager.ViewModel
{
    public delegate void OnMyAccountInfoHandler();
    public delegate void OnViewEmpHandler();
    public delegate void OnViewCustomerHandler();
    public delegate void OnViewInvoiceSellHanlder();
    public delegate void OnViewProductHandler();

    public class HomeControlViewModel
    {
        #region ICommand
        public ICommand MyAccountInfoCommand
        {
            get;
            private set;
        }

        public ICommand CustomerFeedBackCommand
        {
            get;
            private set;
        }

        public ICommand ViewEmpCommand
        {
            get;
            private set;
        }

        public ICommand ViewCustomerCommand
        {
            get;
            private set;
        }

        public ICommand ViewInvoiceSellCommand
        {
            get;
            private set;
        }

        public ICommand ViewInvoiceBuyCommand
        {
            get;
            private set;
        }

        public ICommand ViewProductCommand
        {
            get;
            private set;
        }
        #endregion

        #region Events
        public event OnMyAccountInfoHandler OnMyAccountInfoClicked;
        public event OnViewEmpHandler OnViewEmpClicked;
        public event OnViewCustomerHandler OnViewCustomerClicked;
        public event OnViewInvoiceSellHanlder OnViewInvoiceSellClicked;
        public event OnViewProductEventHander OnViewProductClicked;
        #endregion

        public HomeControlViewModel() {
            InitCmd();
        }

        public void InitCmd()
        {
            MyAccountInfoCommand = new ExecutableCommand(DoMyAccountInfo);
            //CustomerFeedBackCommand = new ExecutableCommand(DoCustomerFeedBack);
            ViewEmpCommand = new ExecutableCommand(DoViewEmp);
            ViewCustomerCommand = new ExecutableCommand(DoViewCustomer);
            ViewInvoiceSellCommand = new ExecutableCommand(DoViewInvoiceSell);
            //ViewInvoiceBuyCommand = new ExecutableCommand(DoViewInvoiceBuy);
            ViewProductCommand = new ExecutableCommand(DoViewProduct);
        }

        public void DoMyAccountInfo()
        {
            if (OnMyAccountInfoClicked != null)
            {
                OnMyAccountInfoClicked();
            }
        }
        //public void DoCustomerFeedBack()
        //{
        //    if (OnCustomerFeedBackClicked != null)
        //    {
        //        OnCustomerFeedBackClicked();
        //    }
        //}
        public void DoViewEmp()
        {
            if (OnViewEmpClicked != null)
            {
                OnViewEmpClicked();
            }
        }
        public void DoViewCustomer()
        {
            if (OnViewCustomerClicked != null)
            {
                OnViewCustomerClicked();
            }

        }
        public void DoViewInvoiceSell()
        {
            if (OnViewInvoiceSellClicked != null)
            {
                OnViewInvoiceSellClicked();
            }
        }
        //public void DoViewInvoiceBuy()
        //{
        //    if (OnViewInvoiceBuyClicked != null)
        //    {
        //        OnViewInvoiceBuyClicked();
        //    }
        //}
        public void DoViewProduct()
        {
            if (OnViewProductClicked != null)
            {
                OnViewProductClicked();
            }
        }
    }
}
